from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import Table, Column, ForeignKey
from sqlalchemy.types import Integer 

__all__ = ['Base']

Base = declarative_base()

user_roles = Table('user_roles', Base.metadata, 
                   Column('user_id', Integer, ForeignKey('users.id'), nullable=False),
                   Column('role_id', Integer, ForeignKey('roles.id'), nullable=False)
                   )

role_permissions = Table('role_permissions', Base.metadata, 
                   Column('role_id', Integer, ForeignKey('roles.id'), nullable=False),
                   Column('permission_id', Integer, ForeignKey('permissions.id'), nullable=False)
                   )

account_moneys = Table("account_moneys", Base.metadata,
                       Column("account_id", Integer, ForeignKey("accounts.id"), nullable=False),
                       Column("money_id", Integer, ForeignKey("moneys.id"), nullable=False)
                       )